//
//  AboutViewController.m
//  dangdang
//
//  Created by air on 15/12/9.
//  Copyright © 2015年 luweijie. All rights reserved.
//

#import "AboutViewController.h"
#import "Profile.h"
#import "AboutDataSource.h"

@interface AboutViewController ()

@end

@implementation AboutViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self updateUI];
    
    self.title = @"关于我们";
}

- (void)updateUI{
    _logoImageView.layer.cornerRadius = _logoImageView.frame.size.width / 2;
    _logoImageView.layer.masksToBounds = YES;
}

#pragma mark UITableViewDataSource && Delegate

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return [[AboutDataSource alloc] init].aboutArray.count;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [[[[AboutDataSource alloc] init].aboutArray objectAtIndex:section] count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
    
    //    [self.personalTableView setSeparatorStyle:UITableViewCellSeparatorStyleSingleLine];
    //    [self.personalTableView setSeparatorColor:[UIColor redColor]];
    
    Profile * profile = [[[[AboutDataSource alloc] init].aboutArray objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
    cell.textLabel.text = profile.functionName;
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 50.0f;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 0.1f;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    Profile * profile = [[[[AboutDataSource alloc] init].aboutArray objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
    if (profile.destinationName != nil && ![profile.destinationName isEqualToString:@""]) {
        [self.navigationController pushViewController:[[UIStoryboard storyboardWithName:profile.destinationName bundle:nil] instantiateViewControllerWithIdentifier:profile.destinationName] animated:YES];
    }
}


@end
